<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<base href="<%=basePath%>">
<title>People List</title>
</head>
<body>
	<h3>People List</h3>
	
	<s:if test="personList.size > 0">
		<ol>
			<s:iterator value="personList">
				<li>
					<s:property value="firstName" />
					<s:property value="lastName" />
					
					<s:url action="edit-person" var="editUrl">
						<s:param name="id" value="id" />
					</s:url>
					<s:url action="delete" var="deleteUrl">
						<s:param name="id" value="id" />
					</s:url>
					
					<a href="${editUrl}">Edit</a>
					<a href="<s:property value='#deleteUrl' />">Delete</a>
				</li>
			</s:iterator>
		</ol>
	</s:if>
	
	<s:url action="create" var="createUrl">
		<s:param name="id" value="-1" />
	</s:url>
	<p><a href="${createUrl}">Create</a> new person.</p>
	<p>
		<a href="<s:url action='../index' />">Return to home page</a>
	</p>
</body>
</html>